#include <stdio.h>
#include <signal.h>
#include "uevent.h"

UEventLoop *g_loop = NULL;

int test_fd_install(UEventLoop *loop);
int test_timer_install(UEventLoop *loop);

static void _SignalHandler(int sig) {
    UEvent_BreakLoop(g_loop);
    puts("got signal");
}

int main() {
    puts("start test");
    signal(SIGINT, _SignalHandler);

    UEventLoop *loop = UEvent_NewLoop();
    g_loop = loop;

    test_fd_install(loop);
    test_timer_install(loop);

    UEvent_RunLoop(loop);

    UEvent_DeleteLoop(loop);

    puts("end test");
    return 0;
}
